/****************************************************************************
 *
 *   Copyright (c) 2020-2023 PX4 Development Team. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 * 3. Neither the name PX4 nor the names of its contributors may be
 *    used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 ****************************************************************************/

#include <stdint.h>

static constexpr float SAMPLING_RES = 10;
static constexpr float SAMPLING_MIN_LAT = -90;
static constexpr float SAMPLING_MAX_LAT = 90;
static constexpr float SAMPLING_MIN_LON = -180;
static constexpr float SAMPLING_MAX_LON = 180;

static constexpr int LAT_DIM = 19;
static constexpr int LON_DIM = 37;


// *INDENT-OFF*
// Magnetic declination data in radians * 10^-4
// Model: WMM-2020,
// Version: 0.5.1.11,
// Date: 2023.6083,
static constexpr const int16_t declination_table[19][37] {
	//    LONGITUDE:   -180,  -170,  -160,  -150,  -140,  -130,  -120,  -110,  -100,   -90,   -80,   -70,   -60,   -50,   -40,   -30,   -20,   -10,     0,    10,    20,    30,    40,    50,    60,    70,    80,    90,   100,   110,   120,   130,   140,   150,   160,   170,   180,
	/* LAT: -90 */ {  25960, 24215, 22470, 20724, 18979, 17233, 15488, 13743, 11998, 10252,  8507,  6762,  5016,  3271,  1526,  -219, -1965, -3710, -5455, -7201, -8946,-10691,-12436,-14182,-15927,-17672,-19418,-21163,-22909,-24654,-26399,-28145,-29890, 31196, 29451, 27706, 25960, },
	/* LAT: -80 */ {  22524, 20396, 18458, 16686, 15047, 13510, 12046, 10636,  9261,  7912,  6580,  5262,  3953,  2648,  1340,    20, -1322, -2696, -4107, -5561, -7058, -8596,-10176,-11796,-13462,-15182,-16969,-18843,-20828,-22948,-25223,-27658,-30226, 29968, 27353, 24851, 22524, },
	/* LAT: -70 */ {  14984, 13584, 12456, 11491, 10620,  9786,  8942,  8053,  7100,  6080,  5010,  3917,  2834,  1780,   760,  -250, -1288, -2397, -3602, -4906, -6291, -7725, -9176,-10620,-12048,-13465,-14895,-16384,-18013,-19935,-22470,-26290, 30623, 24105, 19619, 16855, 14984, }, // WARNING! black out zone
	/* LAT: -60 */ {   8447,  8196,  7910,  7631,  7373,  7115,  6804,  6368,  5750,  4928,  3926,  2814,  1697,   674,  -202,  -955, -1683, -2509, -3521, -4728, -6067, -7442, -8766, -9977,-11041,-11938,-12652,-13146,-13318,-12869,-10759, -3420,  5009,  7718,  8471,  8588,  8447, }, // WARNING! black out zone
	/* LAT: -50 */ {   5505,  5539,  5480,  5387,  5309,  5269,  5231,  5101,  4754,  4087,  3073,  1799,   460,  -712, -1571, -2123, -2513, -2956, -3654, -4686, -5945, -7230, -8373, -9272, -9864,-10094, -9891, -9124, -7608, -5240, -2330,   419,  2529,  3955,  4829,  5303,  5505, },
	/* LAT: -40 */ {   3969,  4061,  4066,  4018,  3954,  3917,  3920,  3907,  3731,  3191,  2161,   714,  -848, -2152, -2999, -3436, -3607, -3661, -3840, -4436, -5440, -6527, -7410, -7939, -8033, -7641, -6738, -5348, -3640, -1945,  -490,   730,  1775,  2645,  3305,  3737,  3969, },
	/* LAT: -30 */ {   2996,  3082,  3108,  3090,  3027,  2946,  2884,  2849,  2720,  2236,  1191,  -337, -1942, -3184, -3907, -4238, -4303, -4077, -3640, -3446, -3847, -4610, -5303, -5639, -5497, -4896, -3928, -2724, -1526,  -591,    80,   679,  1306,  1914,  2429,  2795,  2996, },
	/* LAT: -20 */ {   2353,  2398,  2412,  2409,  2362,  2264,  2154,  2076,  1930,  1429,   361, -1137, -2613, -3659, -4174, -4274, -4056, -3481, -2614, -1835, -1590, -1966, -2618, -3076, -3099, -2729, -2088, -1276,  -510,   -31,   225,   524,   969,  1455,  1884,  2197,  2353, },
	/* LAT: -10 */ {   1960,  1953,  1927,  1918,  1886,  1797,  1683,  1589,  1404,   849,  -223, -1606, -2873, -3686, -3932, -3687, -3100, -2313, -1469,  -723,  -274,  -324,  -804, -1306, -1510, -1413, -1097,  -601,  -112,   120,   161,   318,   694,  1141,  1542,  1836,  1960, },
	/* LAT:   0 */ {   1746,  1712,  1651,  1638,  1622,  1549,  1438,  1320,  1065,   441,  -604, -1833, -2878, -3448, -3427, -2912, -2139, -1359,  -712,  -180,   227,   327,    38,  -379,  -628,  -681,  -583,  -324,   -40,    41,   -28,    57,   404,   856,  1285,  1612,  1746, },
	/* LAT:  10 */ {   1607,  1614,  1568,  1580,  1602,  1548,  1421,  1229,   852,   134,  -888, -1961, -2778, -3102, -2882, -2266, -1488,  -780,  -271,   107,   430,   572,   402,    79,  -152,  -259,  -286,  -210,  -111,  -158,  -305,  -281,    25,   489,   979,  1393,  1607, },
	/* LAT:  20 */ {   1417,  1565,  1623,  1713,  1796,  1772,  1612,  1305,   760,   -95, -1135, -2080, -2666, -2762, -2424, -1817, -1106,  -460,    -4,   302,   559,   700,   604,   360,   163,    43,   -54,  -125,  -211,  -405,  -647,  -707,  -468,   -13,   534,  1057,  1417, },
	/* LAT:  30 */ {   1107,  1473,  1732,  1955,  2114,  2122,  1931,  1506,   778,  -247, -1359, -2226, -2630, -2559, -2155, -1573,  -917,  -302,   157,   459,   688,   831,   806,   656,   508,   382,   218,    -2,  -292,  -670, -1041, -1200, -1036,  -605,   -25,   586,  1107, },
	/* LAT:  40 */ {    739,  1324,  1819,  2212,  2462,  2506,  2290,  1756,   847,  -375, -1602, -2457, -2769, -2612, -2163, -1570,  -917,  -288,   218,   580,   848,  1042,  1132,  1119,  1043,   892,   615,   193,  -355,  -965, -1485, -1725, -1605, -1186,  -587,    82,   739, },
	/* LAT:  50 */ {    436,  1181,  1863,  2424,  2794,  2903,  2677,  2026,   892,  -593, -2001, -2904, -3192, -2999, -2508, -1862, -1153,  -456,   157,   660,  1076,  1427,  1703,  1870,  1886,  1693,  1237,   514,  -390, -1294, -1967, -2247, -2118, -1678, -1047,  -322,   436, },
	/* LAT:  60 */ {    222,  1071,  1877,  2577,  3088,  3309,  3103,  2305,   811, -1123, -2820, -3793, -4046, -3788, -3218, -2475, -1651,  -813,    -8,   741,  1431,  2059,  2598,  2988,  3141,  2943,  2288,  1153,  -273, -1591, -2449, -2750, -2583, -2093, -1409,  -619,   222, },
	/* LAT:  70 */ {    -47,   883,  1779,  2581,  3202,  3508,  3276,  2184,    17, -2630, -4567, -5406, -5432, -4962, -4202, -3275, -2256, -1194,  -123,   934,  1957,  2920,  3785,  4488,  4927,  4947,  4315,  2811,   591, -1519, -2807, -3244, -3086, -2561, -1823,  -964,   -47, }, // WARNING! black out zone
	/* LAT:  80 */ {   -864,    55,   904,  1595,  1987,  1837,   743, -1642, -4648, -6750, -7562, -7492, -6908, -6022, -4952, -3769, -2514, -1217,   102,  1425,  2737,  4018,  5245,  6384,  7382,  8144,  8486,  8024,  6018,  2070, -1618, -3319, -3658, -3315, -2633, -1784,  -864, }, // WARNING! black out zone
	/* LAT:  90 */ { -29433,-27688,-25942,-24197,-22451,-20706,-18961,-17215,-15470,-13725,-11980,-10234, -8489, -6744, -4999, -3254, -1509,   236,  1982,  3727,  5472,  7217,  8962, 10708, 12453, 14199, 15944, 17689, 19435, 21180, 22926, 24671, 26417, 28162, 29908,-31178,-29433, }, // WARNING! black out zone
};
static constexpr float WMM_DECLINATION_MIN_RAD = -3.118; // latitude: 90, longitude: 170
static constexpr float WMM_DECLINATION_MAX_RAD = 3.120; // latitude: -90, longitude: 150


// Magnetic inclination data in radians * 10^-4
// Model: WMM-2020,
// Version: 0.5.1.11,
// Date: 2023.6083,
static constexpr const int16_t inclination_table[19][37] {
	//    LONGITUDE:   -180,  -170,  -160,  -150,  -140,  -130,  -120,  -110,  -100,   -90,   -80,   -70,   -60,   -50,   -40,   -30,   -20,   -10,     0,    10,    20,    30,    40,    50,    60,    70,    80,    90,   100,   110,   120,   130,   140,   150,   160,   170,   180,
	/* LAT: -90 */ { -12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565, },
	/* LAT: -80 */ { -13648,-13514,-13353,-13173,-12979,-12778,-12574,-12374,-12184,-12008,-11852,-11718,-11608,-11521,-11458,-11416,-11396,-11399,-11426,-11480,-11564,-11678,-11824,-11997,-12196,-12413,-12643,-12876,-13104,-13316,-13502,-13652,-13755,-13805,-13801,-13747,-13648, },
	/* LAT: -70 */ { -14095,-13776,-13457,-13134,-12803,-12459,-12105,-11749,-11406,-11099,-10848,-10665,-10554,-10502,-10487,-10489,-10494,-10502,-10524,-10580,-10688,-10864,-11112,-11428,-11802,-12221,-12670,-13134,-13600,-14052,-14469,-14812,-14997,-14941,-14709,-14411,-14095, }, // WARNING! black out zone
	/* LAT: -60 */ { -13512,-13158,-12819,-12486,-12143,-11771,-11356,-10902,-10436,-10007, -9680, -9508, -9508, -9646, -9849,-10038,-10158,-10196,-10179,-10163,-10211,-10372,-10666,-11078,-11580,-12137,-12725,-13321,-13910,-14471,-14968,-15257,-15076,-14688,-14281,-13886,-13512, }, // WARNING! black out zone
	/* LAT: -50 */ { -12493,-12150,-11818,-11495,-11172,-10826,-10427, -9956, -9428, -8909, -8524, -8405, -8612, -9076, -9639,-10145,-10496,-10649,-10609,-10451,-10309,-10320,-10549,-10972,-11519,-12113,-12699,-13236,-13681,-13978,-14084,-14011,-13807,-13523,-13193,-12844,-12493, },
	/* LAT: -40 */ { -11239,-10889,-10540,-10194, -9854, -9517, -9157, -8733, -8213, -7651, -7232, -7201, -7672, -8502, -9422,-10245,-10896,-11319,-11444,-11263,-10915,-10649,-10653,-10944,-11412,-11917,-12360,-12677,-12833,-12837,-12748,-12612,-12434,-12203,-11916,-11587,-11239, },
	/* LAT: -30 */ {  -9602, -9220, -8837, -8446, -8054, -7680, -7325, -6937, -6426, -5816, -5373, -5474, -6262, -7473, -8722, -9810,-10716,-11414,-11796,-11768,-11384,-10876,-10552,-10563,-10821,-11143,-11395,-11502,-11436,-11261,-11089,-10959,-10817,-10611,-10330, -9983, -9602, },
	/* LAT: -20 */ {  -7373, -6926, -6504, -6073, -5629, -5201, -4813, -4405, -3842, -3159, -2723, -3009, -4145, -5770, -7395, -8751, -9803,-10564,-10985,-11002,-10624,-10004, -9450, -9215, -9271, -9434, -9572, -9584, -9408, -9137, -8948, -8869, -8772, -8568, -8252, -7837, -7373, },
	/* LAT: -10 */ {  -4418, -3872, -3412, -2971, -2514, -2065, -1655, -1208,  -588,   110,   456,     1, -1358, -3291, -5260, -6848, -7922, -8538, -8787, -8710, -8286, -7591, -6929, -6592, -6557, -6651, -6765, -6785, -6595, -6300, -6153, -6175, -6147, -5936, -5552, -5020, -4418, },
	/* LAT:   0 */ {   -911,  -276,   198,   604,  1023,  1439,  1825,  2259,  2833,  3402,  3589,  3068,  1745,  -183, -2221, -3848, -4830, -5238, -5283, -5101, -4647, -3920, -3215, -2851, -2793, -2860, -2983, -3054, -2923, -2690, -2645, -2805, -2883, -2704, -2279, -1644,  -911, },
	/* LAT:  10 */ {   2557,  3194,  3635,  3980,  4336,  4702,  5049,  5427,  5869,  6230,  6253,  5746,  4643,  3064,  1376,    20,  -760,  -988,  -885,  -641,  -219,   429,  1062,  1394,  1458,  1418,  1320,  1229,  1271,  1371,  1286,  1003,   795,   860,  1213,  1821,  2557, },
	/* LAT:  20 */ {   5413,  5949,  6333,  6631,  6945,  7287,  7627,  7967,  8292,  8485,  8388,  7913,  7065,  5962,  4840,  3943,  3431,  3327,  3487,  3736,  4073,  4544,  5005,  5258,  5317,  5305,  5259,  5201,  5187,  5164,  4983,  4639,  4330,  4235,  4408,  4835,  5413, },
	/* LAT:  30 */ {   7568,  7944,  8264,  8548,  8857,  9203,  9558,  9894, 10165, 10272, 10121,  9692,  9058,  8346,  7688,  7184,  6902,  6870,  7019,  7234,  7485,  7788,  8078,  8251,  8310,  8327,  8332,  8322,  8297,  8210,  7983,  7623,  7262,  7039,  7023,  7220,  7568, },
	/* LAT:  40 */ {   9266,  9487,  9744, 10029, 10355, 10715, 11081, 11416, 11664, 11742, 11588, 11225, 10751, 10279,  9886,  9608,  9464,  9466,  9581,  9746,  9924, 10110, 10283, 10408, 10487, 10550, 10608, 10641, 10622, 10508, 10262,  9908,  9538,  9252,  9109,  9122,  9266, },
	/* LAT:  50 */ {  10802, 10923, 11123, 11392, 11714, 12067, 12419, 12733, 12952, 13009, 12868, 12570, 12206, 11863, 11590, 11407, 11317, 11317, 11387, 11493, 11609, 11726, 11843, 11960, 12079, 12203, 12318, 12390, 12378, 12250, 12001, 11671, 11331, 11046, 10856, 10776, 10802, },
	/* LAT:  60 */ {  12320, 12391, 12539, 12756, 13024, 13323, 13623, 13888, 14063, 14090, 13955, 13707, 13420, 13150, 12931, 12777, 12688, 12659, 12677, 12726, 12796, 12883, 12990, 13123, 13283, 13460, 13625, 13733, 13736, 13613, 13386, 13107, 12829, 12592, 12422, 12330, 12320, },
	/* LAT:  70 */ {  13757, 13798, 13891, 14030, 14208, 14409, 14616, 14796, 14901, 14884, 14751, 14552, 14336, 14133, 13960, 13826, 13733, 13680, 13662, 13675, 13719, 13792, 13896, 14034, 14201, 14389, 14573, 14712, 14756, 14682, 14519, 14321, 14126, 13962, 13841, 13772, 13757, }, // WARNING! black out zone
	/* LAT:  80 */ {  14993, 15004, 15039, 15097, 15171, 15255, 15332, 15378, 15364, 15290, 15181, 15059, 14938, 14825, 14726, 14644, 14583, 14542, 14524, 14529, 14556, 14605, 14677, 14771, 14883, 15010, 15146, 15279, 15386, 15429, 15387, 15298, 15201, 15115, 15049, 15008, 14993, }, // WARNING! black out zone
	/* LAT:  90 */ {  15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, }, // WARNING! black out zone
};
static constexpr float WMM_INCLINATION_MIN_RAD = -1.526; // latitude: -60, longitude: 130
static constexpr float WMM_INCLINATION_MAX_RAD = 1.543; // latitude: 80, longitude: 110


// Magnetic strength data in milli-Gauss * 10
// Model: WMM-2020,
// Version: 0.5.1.11,
// Date: 2023.6083,
static constexpr const int16_t strength_table[19][37] {
	//    LONGITUDE:  -180, -170, -160, -150, -140, -130, -120, -110, -100,  -90,  -80,  -70,  -60,  -50,  -40,  -30,  -20,  -10,    0,   10,   20,   30,   40,   50,   60,   70,   80,   90,  100,  110,  120,  130,  140,  150,  160,  170,  180,
	/* LAT: -90 */ {  5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, },
	/* LAT: -80 */ {  6052, 5987, 5908, 5816, 5712, 5600, 5482, 5360, 5238, 5118, 5004, 4899, 4805, 4726, 4663, 4619, 4595, 4593, 4615, 4661, 4732, 4827, 4942, 5074, 5218, 5368, 5518, 5661, 5792, 5906, 5998, 6067, 6111, 6130, 6125, 6098, 6052, },
	/* LAT: -70 */ {  6296, 6162, 6011, 5845, 5666, 5473, 5268, 5053, 4834, 4619, 4417, 4235, 4078, 3947, 3843, 3767, 3721, 3709, 3738, 3815, 3944, 4125, 4355, 4623, 4919, 5227, 5530, 5814, 6064, 6267, 6418, 6513, 6554, 6545, 6495, 6409, 6296, },
	/* LAT: -60 */ {  6182, 5988, 5786, 5576, 5356, 5121, 4864, 4586, 4294, 4005, 3738, 3512, 3333, 3200, 3101, 3028, 2977, 2957, 2984, 3075, 3246, 3499, 3828, 4215, 4638, 5073, 5494, 5878, 6202, 6450, 6612, 6690, 6691, 6627, 6512, 6360, 6182, },
	/* LAT: -50 */ {  5840, 5609, 5376, 5144, 4911, 4665, 4394, 4091, 3762, 3431, 3130, 2891, 2731, 2641, 2592, 2557, 2523, 2496, 2501, 2575, 2751, 3044, 3444, 3917, 4425, 4931, 5405, 5823, 6161, 6402, 6539, 6578, 6535, 6423, 6260, 6061, 5840, },
	/* LAT: -40 */ {  5390, 5144, 4898, 4657, 4422, 4184, 3929, 3645, 3331, 3005, 2707, 2486, 2370, 2346, 2365, 2385, 2388, 2374, 2361, 2391, 2524, 2805, 3227, 3744, 4292, 4815, 5280, 5667, 5958, 6144, 6232, 6234, 6163, 6031, 5849, 5630, 5390, },
	/* LAT: -30 */ {  4877, 4635, 4395, 4159, 3933, 3713, 3494, 3263, 3007, 2731, 2474, 2293, 2225, 2251, 2318, 2388, 2452, 2501, 2520, 2532, 2602, 2807, 3175, 3667, 4199, 4695, 5111, 5425, 5626, 5725, 5751, 5724, 5644, 5511, 5331, 5114, 4877, },
	/* LAT: -20 */ {  4320, 4106, 3896, 3691, 3494, 3312, 3143, 2979, 2801, 2602, 2411, 2279, 2240, 2286, 2376, 2487, 2614, 2740, 2826, 2859, 2885, 2986, 3232, 3620, 4072, 4498, 4844, 5075, 5179, 5186, 5155, 5108, 5026, 4898, 4731, 4534, 4320, },
	/* LAT: -10 */ {  3790, 3628, 3474, 3327, 3191, 3071, 2967, 2874, 2776, 2660, 2538, 2440, 2397, 2424, 2513, 2642, 2798, 2955, 3076, 3136, 3150, 3178, 3306, 3562, 3891, 4212, 4475, 4635, 4668, 4615, 4548, 4485, 4397, 4272, 4123, 3958, 3790, },
	/* LAT:   0 */ {  3412, 3318, 3233, 3160, 3104, 3066, 3039, 3019, 2993, 2944, 2865, 2771, 2693, 2665, 2709, 2814, 2946, 3081, 3194, 3268, 3298, 3321, 3398, 3558, 3769, 3983, 4162, 4266, 4271, 4203, 4114, 4022, 3911, 3780, 3645, 3520, 3412, },
	/* LAT:  10 */ {  3282, 3251, 3230, 3225, 3249, 3296, 3350, 3402, 3436, 3425, 3356, 3242, 3116, 3024, 3001, 3044, 3126, 3224, 3324, 3409, 3472, 3535, 3625, 3744, 3881, 4021, 4140, 4209, 4210, 4148, 4037, 3894, 3732, 3572, 3436, 3339, 3282, },
	/* LAT:  20 */ {  3399, 3401, 3426, 3479, 3570, 3690, 3818, 3934, 4013, 4025, 3951, 3810, 3644, 3507, 3434, 3424, 3460, 3534, 3631, 3729, 3820, 3919, 4031, 4143, 4253, 4365, 4468, 4534, 4543, 4483, 4345, 4142, 3914, 3704, 3540, 3439, 3399, },
	/* LAT:  30 */ {  3722, 3727, 3780, 3878, 4020, 4190, 4365, 4520, 4627, 4653, 4580, 4426, 4238, 4076, 3974, 3929, 3935, 3987, 4075, 4174, 4272, 4379, 4496, 4614, 4734, 4862, 4983, 5070, 5094, 5035, 4878, 4637, 4362, 4108, 3908, 3778, 3722, },
	/* LAT:  40 */ {  4222, 4218, 4281, 4402, 4568, 4754, 4937, 5093, 5197, 5223, 5155, 5008, 4823, 4651, 4525, 4451, 4427, 4451, 4513, 4593, 4680, 4778, 4893, 5027, 5178, 5341, 5493, 5602, 5640, 5584, 5427, 5188, 4914, 4655, 4444, 4298, 4222, },
	/* LAT:  50 */ {  4832, 4822, 4875, 4982, 5127, 5286, 5435, 5557, 5631, 5641, 5579, 5453, 5292, 5130, 4994, 4898, 4845, 4834, 4860, 4911, 4981, 5073, 5192, 5343, 5519, 5703, 5869, 5986, 6028, 5982, 5850, 5655, 5431, 5216, 5036, 4905, 4832, },
	/* LAT:  60 */ {  5393, 5377, 5402, 5463, 5547, 5641, 5728, 5795, 5830, 5822, 5770, 5677, 5557, 5430, 5312, 5217, 5152, 5119, 5117, 5146, 5203, 5290, 5408, 5556, 5722, 5890, 6037, 6139, 6182, 6159, 6076, 5950, 5805, 5663, 5541, 5448, 5393, },
	/* LAT:  70 */ {  5726, 5704, 5699, 5709, 5731, 5757, 5781, 5796, 5797, 5779, 5741, 5685, 5616, 5540, 5467, 5404, 5357, 5329, 5325, 5345, 5391, 5461, 5553, 5661, 5778, 5892, 5991, 6063, 6101, 6104, 6075, 6022, 5955, 5885, 5819, 5765, 5726, },
	/* LAT:  80 */ {  5790, 5772, 5756, 5744, 5733, 5724, 5714, 5703, 5688, 5671, 5649, 5625, 5598, 5572, 5547, 5528, 5514, 5510, 5515, 5530, 5556, 5591, 5634, 5682, 5732, 5780, 5822, 5856, 5880, 5893, 5895, 5888, 5873, 5854, 5832, 5810, 5790, },
	/* LAT:  90 */ {  5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, },
};
static constexpr float WMM_STRENGTH_MIN_GS = 22.2; // latitude: -30, longitude: -60
static constexpr float WMM_STRENGTH_MAX_GS = 66.9; // latitude: -60, longitude: 140
static constexpr float WMM_STRENGTH_MEAN_GS = 46.4;
static constexpr float WMM_STRENGTH_MEDIAN_GS = 48.8;


